home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
newsgroups
/
misc.19971216-19980424
/
000272_news@newsmaster….columbia.edu _Fri Feb 27 11:15:05 1998.msg
< prev
next >
Wrap
Internet Message Format
|
2020-01-01
|
4KB
Return-Path: <news@newsmaster.cc.columbia.edu>
Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.35.30])
by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id LAA03147
for <kermit.misc@watsun.cc.columbia.edu>; Fri, 27 Feb 1998 11:15:04 -0500 (EST)
Received: (from news@localhost)
by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id LAA06865
for kermit.misc@watsun; Fri, 27 Feb 1998 11:15:04 -0500 (EST)
Path: news.columbia.edu!watsun.cc.columbia.edu!fdc
From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
Newsgroups: comp.protocols.kermit.misc
Subject: Re: Catching errors while executing 'run console-app' commands in K95 ?
Date: 27 Feb 1998 16:15:02 GMT
Organization: Columbia University
Lines: 62
Message-ID: <6d6oq6$7bt$1@apakabar.cc.columbia.edu>
References: <6d6jic$q5a$1@horus.mch.sni.de>
NNTP-Posting-Host: watsun.cc.columbia.edu
Xref: news.columbia.edu comp.protocols.kermit.misc:8464
In article <6d6jic$q5a$1@horus.mch.sni.de>,
Michel Dalle <Michel.Dalle@sni.be> wrote:
: I'm still trying to catch all kinds of errors while I'm executing scripts
: with K95. What has me stumped now is the following :
:
: In a Kermit script, I want to launch a "console application" (something that
: runs in the DOS box of Windows 95 and NT). The console application returns a
: status of 0 if everything is OK, and it sends some messages to STDOUT. If
: the console application failes, it returns a status of 1, 2, 3, ... and
: prints a corresponding message to STDERR (this can be modified if needed).
:
: How can I :
:
: 1) know whether Kermit could launch the console application at all (e.g.
: no "Bad command or file name" message)
:
How could you know unless you try? I suppose you can use an IF EXIST
command to see if the program executable file exists, but of course that
does not guarantee it can be run.
: 2) know whether the console application executed correctly or not.
:
This depends on the program's exit status code. However, K95 has a bug in
which the return code of a program or command that you start from K95 is not
captured. This bug is fixed in 1.1.16, to be announced shortly.
: 3) if there is an error, catch the error messages from stderr to some
: variable in the script.
:
I don't think there is any good way to do this. First, Windows 95 has
bugs in this area. When you attempt to start an application from a
different kind of application (16-bit, 32-bit, Console, GUI, etc) and
redirect the application's i/o, handles are clobbered, etc, and matters
deteriorate pretty rapidly from there -- frozen windows, dead system, etc.
Even if it worked, I don't think the Windows shell gives you a way to
redirect stderr. So assuming the application wrote such messages to
stderr, you'd have to run some other shell that allowed stderr to be
redirected.
: 4) if there is no error, catch the stdout messages to some variable in
: the script.
:
There is a mechanism for this, but whether it works depends on the
application and on Windows. It is the \fcommand() function. Example that
works:
echo "\fcommand(echo hi there)"
prints "hi there". Here's another that works as long as the file x.x is
not too long:
assign \%n \fcommand(type x.x)
This assigns the contents of the x.x file to the variable \%n.
: From what I've seen in tests, \v(status) and \v(exitstatus) always return 0,
: and \v(pexitstat) always returns 1, independently of the success or failure
: of the console application (at least on Windows 95... ).
:
Right, that's the bug described above. We'll have a fix for you soon.
- Frank